package com.igeek.yygh.controller;

import com.igeek.yygh.constant.MessageConstant;
import com.igeek.yygh.model.child.Child;
import com.igeek.yygh.result.Result;
import com.igeek.yygh.result.Results;
import com.igeek.yygh.service.ChildService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author Guzhenghui
 * @since 2024/8/21
 */
@RestController
@RequestMapping("/admin/child")
@Slf4j
@Api(tags = "子女管理")
public class ChildController {
    @Autowired
    private ChildService  childService;

    @GetMapping("/findOne/{id}")
    public Results FindOne(@PathVariable("id") Long id){
        Child byId = childService.getById(id);
        try {
            Child child = childService.getById(id);
            return new Results(true , MessageConstant.QUERY_CHECKITEM_SUCCESS , child);
        }catch (Exception e){
            e.printStackTrace();
        }
        return new Results(true , MessageConstant.QUERY_CHECKITEM_FAIL);
    }
}
